---
title: clsHazardGroupCollection
summary: API reference for clsHazardGroupCollection.
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Business.Policy
reference_type: embedded
---

# clsHazardGroupCollection

Retrieves the hazard-group rows whose effective window contains a requested date and exposes them as a read-only BOF collection. The collection owns the `HAZARD_GROUP` SQL, materializes each child `clsHazardGroup`, and disables end-user edits and removals while still participating in framework collection lifecycle behavior†.

## Purpose
- Execute the effective-dated `HAZARD_GROUP` lookup used by policy components that need hazard-group classifications.
- Hold the resulting `clsHazardGroup` children in a BOF collection with lookup helpers by index and identifier.
- Keep the collection retrieve-only by disallowing save semantics and by delegating all SQL ownership to the nested criteria object.

## Context
- Namespace: `SAIF.Business.Policy`
- Assembly/package: `SAIF.Business.Policy`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item` | `Default Public Overloads ReadOnly Property Item(ByVal Index As Integer) As clsHazardGroup` | Returns the child hazard group at the requested collection position. |
| `ItemByKey` | `Public ReadOnly Property ItemByKey(ByVal inHazardGroupID As String) As clsHazardGroup` | Finds the first child whose `HazardGroupID` matches the supplied business key. |
| `MyCriteria` | `Public ReadOnly Property MyCriteria() As Criteria` | Exposes the effective-date criteria that drove the current retrieval. |
| `IsValid` | `Public Overrides ReadOnly Property IsValid() As Boolean` | Reports the collection as valid; this library defines no collection-specific rules. |
| `IsSavable` | `Public ReadOnly Property IsSavable() As Boolean` | Advertises that this collection is never saved back through this library. |
| `Contains` | `Public Overloads Function Contains(ByVal inObject As clsHazardGroup) As Boolean` | Checks whether a specific hazard-group child is present in the active list. |
| `Contains` | `Public Overloads Function Contains(ByVal inHazardGroupID As String) As Boolean` | Checks whether the active list contains a hazard group with the requested identifier. |
| `ContainsDeleted` | `Public Overloads Function ContainsDeleted(ByVal inObject As clsHazardGroup) As Boolean` | Checks whether a specific child is currently tracked in the deleted-items list. |
| `ContainsDeleted` | `Public Overloads Function ContainsDeleted(ByVal inHazardGroupID As String) As Boolean` | Checks whether a deleted child with the requested identifier is being tracked. |
| `Remove` | `Public Overloads Sub Remove(ByVal inObject As clsHazardGroup)` | Removes a child from the active list when collection-manipulation code calls it programmatically. |
| `Remove` | `Public Overloads Sub Remove(ByVal inHazardGroupID As String)` | Removes the first child whose identifier matches the supplied key. |
| `GetHazardGroupCollection` | `Public Shared Function GetHazardGroupCollection(ByVal inDataportal As IDataPortalInfo, ByVal inEffectiveDate As Date) As clsHazardGroupCollection` | Obsolete factory retained for callers that still use the older name; it delegates to the same retrieve flow as `GetHazardGroups`. |
| `GetHazardGroups` | `Public Shared Function GetHazardGroups(ByVal inDataportal As IDataPortalInfo, ByVal inEffectiveDate As Date) As clsHazardGroupCollection` | Retrieves the read-only set of hazard groups active for the supplied effective date. |

## Nested types
### Criteria

`clsHazardGroupCollection.Criteria` carries the portal context, the requested effective date, and the retrieve SQL used by `BeforeRetrieve`.

| Member | Signature | Purpose |
| --- | --- | --- |
| `EffectiveDate` | `Public Property EffectiveDate() As Date` | Supplies the date used to filter rows whose effective window contains the caller's request. |
| `New` | `Public Sub New(ByVal inDataportal As IDataPortalInfo)` | Creates a criteria shell around the current data-portal context. |
| `DataPortalInfo` | `Friend Property DataPortalInfo() As IDataPortalInfo` | Stores the framework portal context used during retrieval. |
| `CreateSQL` | `Friend ReadOnly Property CreateSQL() As String` | Always throws `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` because the criteria is retrieve-only. |
| `DeleteSQL` | `Friend ReadOnly Property DeleteSQL() As String` | Always throws `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` because the criteria is retrieve-only. |
| `InsertSQL` | `Friend ReadOnly Property InsertSQL() As String` | Always throws `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` because the criteria is retrieve-only. |
| `RetrieveSQL` | `Friend ReadOnly Property RetrieveSQL() As String` | Builds the `HAZARD_GROUP` select used by `BeforeRetrieve`, including the effective-date `WHERE` clause and parameter placeholder. |
| `UpdateSQL` | `Friend ReadOnly Property UpdateSQL() As String` | Always throws `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` because the criteria is retrieve-only. |

## Inherited public members
### From clsBusinessCollection (SAIF.Framework.Core)

Members in this section are inherited from `clsBusinessCollection` in `SAIF.Framework.Core`.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `Rules` | `Public ReadOnly Property Rules As clsRulesManager` | Gives the collection access to BOF rule evaluation and broken-rule tracking infrastructure.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `ErrorCount` | `Public ReadOnly Property ErrorCount As Integer` | Reports how many validation errors are currently aggregated across the collection.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `ErrorMessages` | `Public ReadOnly Property ErrorMessages As String` | Returns the aggregated validation-error messages produced by the collection and its children.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `WarningCount` | `Public ReadOnly Property WarningCount As Integer` | Reports how many warnings are currently aggregated across the collection.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `WarningMessages` | `Public ReadOnly Property WarningMessages As String` | Returns the aggregated warning messages exposed by the collection surface.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `Save` | `Public Function Save() As Object` | Persists a managed collection by validating it, processing deferred deletions first, and then saving active children.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `SaveChild` | `Public Function SaveChild() As Object` | Persists the collection as part of a parent save flow when the collection participates as a child object.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `Error` | `Public ReadOnly Property Error As String` | Surfaces aggregate broken-rule text for data-binding consumers through `IDataErrorInfo`.† | `SAIF.Framework.Core` — `clsBusinessCollection` |
| `Item` | `Public ReadOnly Property Item(columnName As String) As String` | Returns the broken-rule message associated with a specific bound field through `IDataErrorInfo`.† | `SAIF.Framework.Core` — `clsBusinessCollection` |

## Behavioral notes
- `BeforeRetrieve` assigns `MyCriteria.RetrieveSQL` to the request and binds the `EffectiveDate` parameter.
- `AfterRetrieve` reads the returned `IDataReader`, creates one `clsHazardGroup` per row, calls `child.Load(...)`, and adds the child to the collection.
- The constructor sets `AllowEdit = False` and `AllowRemove = False`, making the collection read-only to consumers even though helper `Remove` methods remain available to programmatic callers.
- Framework collection lifecycle operations cover retrieval, validation, edit sessions, and managed-save flows for BOF collections.†

## Constraints and usage notes
- Use `GetHazardGroups` for new code; `GetHazardGroupCollection` remains only for backward compatibility.
- The effective-date filter is implemented as `:EffectiveDate >= H.EFFECTIVE_DATE` and `:EffectiveDate < NVL(H.EXPIRATION_DATE, :EffectiveDate + 1)` via the nested criteria SQL.

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. They describe inherited behavior from the
> indicated origin library and should be verified if the dependency version changes.

## Sources
- `SAIF.Business.Policy\clsHazardGroupCollection.vb`